@extends('default.layouts.personalPublic')
@section('title', '职位收藏夹')
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/personal/resumeList.css')}}">
@endsection
@section('rightcon')
    <div class="right">

        <!--职位收藏夹-->
        <div class="jright">
            <div class="content">
                <div class="jobtitle">
                    <div class="tithead">
                        <h2>职位收藏夹</h2>
                    </div>
                </div>
                {{--\搜索内容--}}
                <div class="jobsearch">
                    <form name="Formso" id="Formso" action="{{url('personal/favorites')}}" method="post">
                        {{csrf_field()}}
                        <span><input name="keyword" class="keyword" id="keyword" placeholder="请输入公司名称或者职位名称"
                                     type="text"/></span>
                        <span><input name="submit" class="searpos" value="" type="submit"/></span>
                    </form>
                </div>

                {{--显示列表--}}
                <div class="pinfo">
                    <form name="thisForm" action="{{url('personal/favorites')}}" method="post">
                        {{csrf_field()}}
                        <div class="listmenu">
                            <ul class="one">
                                <li class="p1"><input name="" class="checkboxs" value="" type="checkbox" onclick="CheckAll(this)"/></li>
                                <li class="p2">职位名称</li>
                                <li class="p5">薪资待遇</li>
                                <li class="p3">工作地点</li>
                                <li class="p4">
                                    <div class="status">
                                        <input id="job_status" name="job_status" type="hidden" value="{{$job_status}}">
                                        <div id="job_status_select" class="select"
                                             style="width:136px; height:28px; line-height: 28px;">
                                            <span><a></a></span><i></i>
                                        </div>
                                    </div>
                                </li>
                                <li class="p6" style="width:120px;">收藏时间</li>
                                <li class="px6" style="width:50px;">操作</li>
                            </ul>
                            <div class="information"><span>共<em>{{$favorites->total()}}</em>条职位收藏记录！</span></div>

                            {{--循环--}}
                            @if($favorites->count() > 0 )
                                @foreach($favorites as $v)
                                    <ul id="list{{$v->id}}">
                                        <li class="p1">
                                            <input name="selected_id[]" class="checkboxs" value="{{$v->job_id}}" type="checkbox"/>
                                        </li>
                                        <li class="p2">
                                            <span class="jpost"><a href="{{url('jobinfo_'.idEncryption($v->job_id).'.html')}}" target="_blank">{{$v->job_title}}</a></span>
                                            <span class="jcompany"><a class="company" href="{{url('comabout_'.idEncryption($v->com_id).'.html')}}" target="_blank">{{$v->company_name}}</a></span>
                                        </li>
                                        <li class="p5">@if(empty($v->salary_above))面试@else{{$v->salary_above}}~{{$v->salary_below}}元/月@endif</li>
                                        <li class="p3">{{$v->location1}}</li>
                                        <li class="p4">@if($v->status > 0)<span class="delivered">已投递</span>@else<span class="nodelivered">未投递</span>@endif</li>
                                        <li class="p6" style="width:120px;">{{$v->created_at}}</li>
                                        <li class="px6" style="width:50px;"><i class="del"></i></li>
                                    </ul>
                                @endforeach
                            @else
                                <div class="nullcon">对不起！没有符合条件的记录！</div>
                            @endif

                            <ul class="one last">
                                <li class="p1" style="width:80px;">
                                    <input name="selectall" id="selectall" class="checkboxs" value="" type="checkbox" onclick="CheckAll(this)"/>
                                    <label for="selectall">全选</label>
                                </li>
                                <li class="p2"><span class="pborder" onclick="showconfirm('{{url('personal/favorites_send')}}','2')">批量投递</span></li>
                            </ul>
                        </div>
                    </form>
                </div>
                {{--分页--}}
                <div class="page_list" style="width: 100%; float: left; margin-top:15px;">
                    {!! $favorites->appends($appends)->links() !!}
                </div>
            </div>
        </div>
    </div>
@endsection
@section('footerjs')
    @parent
    <script>
        $('#favorites').addClass('on').find('i').css('background-position','-26px -69px');
        $(function(){
            var status = [
                {"value":'',"text":"不限"},
                {"value":1,"text":"已投递"},
                {"value":2,"text":"未投递"}
            ];
            var listmenu = $('.right').find('.pinfo').find('.listmenu');
            listmenu.find("#job_status").select({
                optionData: status,
                selected:'{{$job_status}}',
                callback:function(val,text){
                    document.thisForm.submit();
                }
            });
            //删除当前
            @if($favorites->count() > 0 )
                @foreach($favorites as $v)
                    listmenu.find("#list" + '{{$v->id}}').find('i.del').click(function(){
                        layer.confirm('您确定要删除这个职位吗？', {
                            btn: ['确定', '取消'] //按钮
                        }, function () {
                            $.post("/personal/favorites_curr_del",{'id':'{{$v->id}}','_token':"{{csrf_token()}}"},function (data) {
                                if(data.status==0){
                                    listmenu.find("#list" + '{{$v->id}}').remove();
                                    layer.msg(data.msg, {icon: 6,time:1500});
                                }else{
                                    layer.msg(data.msg, {icon: 5,time:1500});
                                }
                            });
                        });
                    });
            @endforeach
            @endif
        });
    </script>
    <script type="text/javascript" src="{{asset('/default/js/personal/resumeList.js')}}"></script>
@endsection